# -*- coding: utf-8 -*-
from openerp.osv import fields
from openerp.osv import osv


class shop(osv.osv):
    _name = 'shop'
    _rec_name = 'name'
    _columns = {
        'name': fields.char(u'商城名字'),

    }


class shop_product_template(osv.osv):
    _name = 'shop.product.template'
    _table='shop_product_rel'
    _columns = {
        'product_tmpl_id': fields.many2one('product.template', string=u'产品', required=True),
        'shop_id': fields.many2one('shop', string='商城', required=True),
        'display_name': fields.char(u'产品名字'),
    }

class product_template(osv.osv):
    _inherit = 'product.template'
    _columns = {
        'shop_ids': fields.many2many('shop', "shop_product_rel", 'product_tmpl_id', 'shop_id', string='上架商城'),
    }
